﻿USE [ESRP]
GO

/****** Object:  Table [dbo].[RegistruAmix]    Script Date: 06/26/2009 13:14:39 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[RegistruAmix](
	[NrInventar] [varchar](20) NOT NULL,
	[Denumire] [varchar](100) NULL,
	[Cont] [varchar](50) NULL,
	[DurataNormata] [int] NULL,
	[ValoareInventar] [decimal](18, 2) NULL,
	[ValoareAmortizata] [decimal](18, 2) NULL,
	[ValoareRamasa] [decimal](18, 2) NULL,
	[AmortizareAn] [decimal](18, 2) NULL,
	[AmortizareLuna] [decimal](18, 2) NULL,
	[StocFaptic] [int] NOT NULL,
	[IDClasificare] [int] NOT NULL,
	[DataIntrare] [datetime] NOT NULL,
	[DataIesire] [datetime] NOT NULL,
	[CodUnitate] [smallint] NOT NULL,
	[IDDepartament] [int] NOT NULL,
	[IDStare] [smallint] NOT NULL,
 CONSTRAINT [PK_RegistruAmix] PRIMARY KEY CLUSTERED 
(
	[NrInventar] ASC,
	[CodUnitate] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[RegistruAmix]  WITH CHECK ADD  CONSTRAINT [FK_RegistruAmix_Departamente] FOREIGN KEY([IDDepartament])
REFERENCES [dbo].[Departamente] ([IDDepartament])
GO

ALTER TABLE [dbo].[RegistruAmix] CHECK CONSTRAINT [FK_RegistruAmix_Departamente]
GO

ALTER TABLE [dbo].[RegistruAmix]  WITH CHECK ADD  CONSTRAINT [FK_RegistruAmix_TipStareMFix] FOREIGN KEY([IDStare])
REFERENCES [dbo].[TipStareMFix] ([IDStare])
GO

ALTER TABLE [dbo].[RegistruAmix] CHECK CONSTRAINT [FK_RegistruAmix_TipStareMFix]
GO

ALTER TABLE [dbo].[RegistruAmix]  WITH CHECK ADD  CONSTRAINT [FK_RegistruAmix_Unitati] FOREIGN KEY([CodUnitate])
REFERENCES [dbo].[Unitati] ([CodUnitate])
GO

ALTER TABLE [dbo].[RegistruAmix] CHECK CONSTRAINT [FK_RegistruAmix_Unitati]
GO

ALTER TABLE [dbo].[RegistruAmix] ADD  CONSTRAINT [DF_RegistruAmix_IDClasificare]  DEFAULT ((0)) FOR [IDClasificare]
GO

ALTER TABLE [dbo].[RegistruAmix] ADD  CONSTRAINT [DF_RegistruAmix_DataIntrare]  DEFAULT (getdate()) FOR [DataIntrare]
GO

ALTER TABLE [dbo].[RegistruAmix] ADD  CONSTRAINT [DF_RegistruAmix_DataIesire]  DEFAULT (getdate()) FOR [DataIesire]
GO

ALTER TABLE [dbo].[RegistruAmix] ADD  CONSTRAINT [DF_RegistruAmix_CodUnitate]  DEFAULT ((0)) FOR [CodUnitate]
GO

ALTER TABLE [dbo].[RegistruAmix] ADD  CONSTRAINT [DF_RegistruAmix_IDDepartament]  DEFAULT ((0)) FOR [IDDepartament]
GO

ALTER TABLE [dbo].[RegistruAmix] ADD  CONSTRAINT [DF_RegistruAmix_IDStare]  DEFAULT ((0)) FOR [IDStare]
GO


